package com.gaea.modules.common.conctroller;

import com.gaea.base.vo.UserVo;
import com.gaea.base.web.BaseController;
import com.gaea.modules.common.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用户控制器
 *
 * @author bjsonghongxu
 * @create 2018-03-29 16:06
 **/

@RestController
@RequestMapping("/user")
public class UserController extends BaseController {


    @Autowired
    private ISysUserService iSysUserService;


    /**
     * 常规用户名密码登录
     * @param userVo
     * @return
     */
    @GetMapping("/login")
    public UserVo login(@RequestBody UserVo userVo) {
        return iSysUserService.login(userVo);
    }


    /**
     * 获取验证码
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping("/getAuthCode")
    public void getVerifyCode(HttpServletResponse response, HttpServletRequest request) throws IOException {
        iSysUserService.createAuthCode(response,request);
    }
}
